var emoRange = "#comments p, div.emoWrap",
    putEmoAbove = "iframe#comment-editor",
    emoMessage = "To insert emoticon you must added at least one space before the code.";

// Emoticon bar before comment-form
$(function() {
    $(putEmoAbove)
        .before('<div style="text-align:center" class="emoWrap"> L-) :-q :)] &lt;):) :(|) =:) :(game) :(tv) :)&gt;- :(fight) :)) :) :(( :( :!! :-c ~X( :O) &lt;:-P =P~ :ar! :o3 :@) 3:-O ~:&gt; @};- %%- **== (~~) ~O) *-:) 8-X &gt;-) $-) [-X &#92;:D/ :-j (*) o-&gt; o=&gt; o-+ (%) [..] &gt;:/ %*-{ :-@ :-L o&#124;&#92;~ o&#124;:-) ^:)^ o&#124;^_^&#124;o %&#124;&#124;:-{ &#39;@^@&#124;&#124;&#124; &#39;@-@ &#39;+_+ &#92;m/ :bolakbalik :-SS :-?? ~x( :-h [-O&lt; ;)) :-&gt;~~ &gt;:P =D&gt; &amp;[] :-(||&gt; :&gt; &gt;:) 8-&gt; &gt;:D&lt; :::^^:::  :-t ^O^||3 :puke! (:| /:) :-&amp; ;;) ;) :D :-/ :x :p :-* =(( :O X( B-) #:-S :-S =)) O:-\)  :-bd :-B =; I-\) 8-| [-( 8-} :-? #-o @-) :^o :-w :-&lt; :| b-( %-( X_X ^#(^ ?@_@? :-)/&#92;:-) []==[] []--- ~^o^~ :-&#36; :-&quot; :&quot;> <br/><b>Click to see the code!</b><br/>To insert emoticon you must added at least one space before the code.</div>');
    var emo = function(emo, imgRep, emoKey) {
        $(emoRange)
            .each(function() {
            $(this)
                .html($(this)
                .html()
                .replace(/<br>:/g, "<br> :")
                .replace(/<br>;/g, "<br> ;")
                .replace(/<br>=/g, "<br> =")
                .replace(/<br>\^/g, "<br> ^")
                .replace(emo, " <img style='max-height:24px' src='" + imgRep + "' class='emo delayLoad' alt='" + emoKey + "' />"));
        });
    };
    emo(/\sL\-\)+/g, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/30.gif", "L-)");
	emo(/\s:-q+/g, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/112.gif", ":-q");
	emo(/\s:\)\]/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/100.gif", ":)]");
	emo(/\s\&lt;\):\)/g, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/48.gif", "&lt;):)");
	emo(/\s:\(\|\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/51.gif", ":(|)");
	emo(/\s=:\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/60.gif", "=:)");
	emo(/\s:\(\game\)/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/play_game.gif", ":(game)");
	emo(/\s:\(tv\)/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/tv.gif", ":(tv)");
	emo(/\s:\)\&gt;-/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/67.gif", ":)&gt;-");
	emo(/\s:\(fight\)/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/fight.gif", ":(fight)");
	emo(/\s:\)\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/21.gif", ":))");
	emo(/\s:\)/g, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/1.gif", ":)");
	emo(/\s:\(\(/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/20.gif", ":((");
	emo(/\s:\(/g, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/2.gif", ":(");
	emo(/\s:\!\!/g, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/110.gif", ":!!");
	emo(/\s:-c/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/101.gif", ":-c");
	emo(/\s\~X\(/g, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/102.gif", "~X(");
	emo(/\s:O\)/g, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/34.gif", ":O)");
	emo(/\s\&lt;:\-P/g, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/36.gif", "&lt;:-P");
	emo(/\s=P\~/g, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/38.gif", "=P~");
	emo(/\s:ar\!/g, "http://l.yimg.com/a/i/us/msg/emoticons/pirate_2.gif", ":ar!");
	emo(/\s:o3/g, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/108.gif", ":o3");
	emo(/\s:@\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/49.gif", ":@)");
	emo(/\s3:-O/g, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/50.gif", "3:-O");
	emo(/\s~:&gt;/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/52.gif", "~:&gt;");
	emo(/\s@\};-/g, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/53.gif", "@};-");
	emo(/\s%%-/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/54.gif", "%%-");
	emo(/\s\*\*==/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/55.gif", "**==");
	emo(/\s\(\~\~\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/56.gif", "(~~)");
	emo(/\s\~O\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/57.gif", "~O)");
	emo(/\s\*-:\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/58.gif", "*-:)");
	emo(/\s8-X/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/59.gif", "8-X");
	emo(/\s&gt;-\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/61.gif", "&gt;-)");
 	emo(/\s\$-\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/64.gif", "$-)");
	emo(/\s\[-X/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/68.gif", "[-X");
	emo(/\s\\:D\//ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/69.gif", "&#92;:D/");
	emo(/\s:-j/g, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/78.gif", ":-j");
	emo(/\s\(\*\)/g, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/79.gif", "(*)");
	emo(/\so-\&gt;/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/72.gif", "o-&gt;");
	emo(/\so=\&gt;/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/73.gif", "o=&gt;");
	emo(/\so-\+/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/74.gif", "o-+");
	emo(/\s\(%\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/115.gif", "(%)");
	emo(/\s\[..\]/g, "http://l.yimg.com/a/i/us/msg/emoticons/transformer.gif", "[..]");
	emo(/\s&gt;:\//g, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/70.gif", "&gt;:/");
	emo(/\s%\*-\{/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/down_on_luck.gif", "%*-{");
 	emo(/\s:-\@/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/76.gif", ":-@");
	emo(/\s:-L/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/62.gif", ":-L");
	emo(/\so\|\\\~/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/sing.gif", "o&#124;&#92;~");
	emo(/\so\|:-\)/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/catch.gif", "o&#124;:-)");
	emo(/\s\^:\)\^/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/77.gif", "^:)^");
	emo(/\so\|\^_\^\|o/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/music.gif", "o|^_^|o");
	emo(/\s%\|\|:-\{/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/unlucky.gif", "%||:-{");
	emo(/\s\'\@\^\@\|\|\|/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/dizzy.gif", "&#39;@^@|||");
 	emo(/\s\'\+\_\+/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/cold.gif", "&#39;+_+");
	emo(/\s\'\@-\@/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/search_me.gif", "&#39;@-@");
	emo(/\s\\m\//ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/111.gif", "&#92;m/");
	emo(/\s:bolakbalik/ig, "https://garis.googlecode.com/svn/wiki/bolakbalik.gif", ":bolakbalik");
	emo(/\s:-SS/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/42.gif", ":-SS");
	emo(/\s:-\?\?/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/106.gif", ":-??");
	emo(/\s\~x\(/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/102.gif", "~x(");
	emo(/\s:-\h/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif", ":-h");
	emo(/\s\[-O\&lt;/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/63.gif", "[-O&lt;");
	emo(/\s;\)\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/71.gif", ";))");
	emo(/\s:-\&gt;\~\~/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/spooky.gif", ":-&gt;~~");
	emo(/\s\&gt;:P/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/47.gif", "&gt;:P");
	emo(/\s=D\&gt;/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/41.gif", "=D&gt;");
	emo(/\s\&amp;\[\]/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/gift.gif", "&amp;[]");
	emo(/\s:-\(\|\|&gt;/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/give_up.gif", ":-(||&gt;");
	emo(/\s:\&gt;/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/15.gif", ":&gt;");
	emo(/\s\&gt;:\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/19.gif", "&gt;:)");
	emo(/\s8\-&gt;/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/105.gif", "8-&gt;");
	emo(/\s\&gt;:D\&lt;/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/6.gif", "&gt;:D&lt;");
	emo(/\s:::\^\^:::/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/hot.gif", ":::^^:::");
	emo(/\s:-t/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/104.gif", ":-t");
	emo(/\s\^O\^\|\|3/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/eat.gif", "^O^||3");
	emo(/\s:puke!/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/puke.gif", ":puke!");
	emo(/\s\(:\|/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/37.gif", "(:|");
	emo(/\s\/:\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/23.gif", "/:)");
	emo(/\s:-\&amp;/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/31.gif", ":-&amp;");
	emo(/\s;;\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/5.gif", ";;)");
	emo(/\s;\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/3.gif", ";)");
	emo(/\s:D/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/4.gif", ":D");
	emo(/\s:-\//ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/7.gif", ":-/");
	emo(/\s:x/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/8.gif", ":x");
	emo(/\s:p/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/10.gif", ":p");
	emo(/\s:-\*/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/11.gif", ":-*");
	emo(/\s=\(\(/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/12.gif", "=((");
	emo(/\s:O/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/13.gif", ":O");
	emo(/\sX\(/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/14.gif", "X(");
	emo(/\sB-\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/16.gif", "B-)");
	emo(/\s\#:-S/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/18.gif", "#:-S");
	emo(/\s:-S/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/17.gif", ":-S");
	emo(/\s=\)\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/24.gif", "=))");
	emo(/\sO:-\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/25.gif", "O:-\)");
	emo(/\s:-bd/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/113.gif", ":-bd");
	emo(/\s:-B/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/26.gif", ":-B");
	emo(/\s=;/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/27.gif", "=;");
	emo(/\sI-\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/28.gif", "I-\)");
	emo(/\s8-\|/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/29.gif", "8-|");
	emo(/\s\[-\(/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/33.gif", "[-(");
	emo(/\s8-\}/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/35.gif", "8-}");
	emo(/\s:-\?/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/39.gif", ":-?");
	emo(/\s#-o/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/40.gif", "#-o");
	emo(/\s@-\)/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/43.gif", "@-)");
	emo(/\s:\^o/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/44.gif", ":^o");
	emo(/\s:-w/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/45.gif", ":-w");
	emo(/\s:-\&lt;/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/46.gif", ":-&lt;");
	emo(/\s:\|/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/22.gif", ":|");
	emo(/\sb-\(/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/66.gif", "b-(");
	emo(/\s%-\(/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/107.gif", "%-(");
	emo(/\sX_X/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/109.gif", "X_X");
	emo(/\s\^\#\(\^/ig, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/114.gif", "^#(^");
	emo(/\s\?@_@\?/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/studying.gif", "?@_@?");
	emo(/\s:-\)\/\\:-\)/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/high_five.gif", ":-)/&#92;:-)");
	emo(/\s\[\]==\[\]/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/exercise.gif", "[]==[]");
	emo(/\s\[\]---/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/cook.gif", "[]---");
	emo(/\s\~\^o\^\~/ig, "http://l.yimg.com/a/lib/msg/img/aurora/emot/201105/cheer.gif", "~^o^~");
	emo(/\s\:-\$/gi, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/32.gif", ":-&#36;");
	emo(/\s\:-\"/gi, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/65.gif", ":-&quot;");
	emo(/\s\:\"\&gt;/gi, "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/9.gif", ":&quot;&gt;");
    

    // Click to show the code!
	   $('.emo')
        .css('cursor', 'pointer')
        .live("click", function(e) {
        $('.emoKey')
            .remove();
        $(this)
            .after('<input class="emoKey" type="text" size="' + this.alt.length + '" value=" ' + this.alt + '" />');
$('.emoKey')
            .trigger("select");
e.stopPropagation();
    });
    $('.emoKey')
        .live("click", function() {
        $(this)
            .focus()
            .select();
    });

});

$(function() {
    var $header = $('#site-header'),
        $panel = $header.find('.inner');
    // Insert a toggle button
    $header.append('<span class="toggle-button"><a href="/">Search</a></span>');
    // Click the toggle button to slide the panel
    $header.find('.toggle-button a').on("click", function() {
        if ($(this).html() == 'Search') {
            $(this).html('&times;');
        } else {
            $(this).html('Search');
        }
        $panel.slideToggle('slow');
        return false;
    });
}); 